/*
 * DeleteAction.java
 *
 * Created on 29 marzec 2007, 21:05
 *
 */

package arocms.news;

import arocms.business.NewsDAO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/**
 *
 * @author arek
 */
public class DeleteAction extends Action{
    
    private static final String SUCCESS = "success";
    private static final String FAILURE = "failure";
    private Logger log = Logger.getLogger(this.getClass());
    
    /** Creates a new instance of DeleteAction */
    public DeleteAction() {
    }

    public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
        String id = request.getParameter("id");
        Long pk = new Long(id);
        new NewsDAO().delete(pk);
        return mapping.findForward(SUCCESS);
    }
    
}
